import 'dart:convert';


import 'package:library_base/err/fb_error.dart';

import 'base_transform.dart';

class FBParseTransform extends ResponseTransform {

  Function(Map<String, dynamic> data)? parse;

  FBParseTransform(this.parse);

  @override
  transformData<T>(String data) {
    if (parse != null) {
      var ss = parse!(json.decode(data));
      return ss;
    } else {
      throw FBError(400, "解析方法不能为空");
    }
  }
}
